<template>
    <div>
        <van-search v-model="value" show-action placeholder="请输入搜索关键词">
            <template #action>
                <div @click="changeValue">搜索</div>
            </template>
        </van-search>
    </div>
</template>
<script lang='ts' setup>
import { ref } from 'vue';
import { storeToRefs } from 'pinia'
import { useCardListStore } from '@/stores/cardStore';
const cardListStore = useCardListStore();
let { keyword, oldKeyword } = storeToRefs(cardListStore);
const value = ref('');
function changeValue() {
    keyword.value = value.value;
    oldKeyword.value.unshift(value.value);
    if (oldKeyword.value.length >= 10) {
        oldKeyword.value.pop();
    }
}
</script>
<style lang='less' scoped>

</style>